<div class="admin_left actions">


    <?php if ($current_customer['group_id'] == '1'): ?>
        <h3 style="font-size:20px;">Manage more</h3>
        <ul>
            <li style="list-style-type:none; margin-bottom:20%;"><?php echo $this->Html->link(__('Edit Customer'), array('action' => 'edit', $customer['Customer']['id']),array('class' => 'consistentButton')); ?> </li>
            <li style="list-style-type:none; margin-bottom:20%;"><?php echo $this->Html->link(__('List Customers'), array('action' => 'index'),array('class' => 'consistentButton')); ?> </li>
            <li style="list-style-type:none; margin-bottom:20%;"><?php echo $this->Html->link(__('Reset Password'), array('action' => 'resetPassword', $customer['Customer']['id']),array('class' => 'consistentButton')); ?></li>
        </ul>
	<?php else: ?>
	    <h3 style="font-size:20px;">My account</h3>
        <ul>
            <li style="list-style-type:none; margin-bottom:20%;"><?php echo $this->Html->link(__('Change my details'), array('action' => 'edit', $customer['Customer']['id']),array('class' => 'consistentButton2')); ?> </li>
            <li style="list-style-type:none; margin-bottom:20%;"><?php echo $this->Html->link(__('Reset Password'), array('action' => 'resetPassword', $customer['Customer']['id']),array('class' => 'consistentButton2')); ?></li>
            <li style="list-style-type:none; margin-bottom:20%;"><?php echo $this->Html->link(__('My purchases'), array('action' => 'resetPassword', $customer['Customer']['id']),array('class' => 'consistentButton2')); ?></li>
        </ul>
	<?php endif; ?>

</div>

    <!-- todo list:
    -   customer id 2 shouldn't be able to see customer id 3 profile
        by typing /customers/view/3. Currently it doesn't display but
        there are no error messages either-->

    <!-- if view/x in url where x does not match current user then don't allow view -->



    <div  class=" admin_right customers view">

        <div id="breadcrumbAdmin" class = "breadcrumb">
            <?php if ($current_customer['group_id'] == '1'): ?>
                <?php $this->Html->addCrumb('View customer', '/Customers/view', array('style'=> ('color:#EB1E70;'))); ?>
                <?php echo $this->Html->getCrumbs(' > ', array( 'text' => 'Customers', 'url' => array('controller' => 'customers', 'action' => 'index'), 'escape' => false)); ?>
            <?php else: ?>
                <?php $this->Html->addCrumb('My account', '/Customers/view', array('style'=> ('text-decoration:underline;  color:#EB1E70;'))); ?>
                <?php echo $this->Html->getCrumbs(' > ', array( 'text' => 'Home', 'url' => array('controller' => 'Pages', 'action' => 'pagehome'), 'escape' => false)); ?>
            <?php endif; ?>
        </div>


        <h2 style="padding:1%;"><?php echo $current_customer['username']; ?><?php  echo __('&#39;s Profile'); ?></h2>

        <table style="float:left; width:40%;  margin-bottom:3%;" class="table">
            <tr>
             <th style="width:200px;  background-color:#FFADCF; color:#fff; font-size:180%;"><?php echo __('Personal Detail'); ?></th>
            </tr>

            <?php if ($current_customer['group_id'] == '1'): ?>
                <tr>
                    <th><?php echo __('Id'); ?></th>
                     <td>
                        <?php echo h($customer['Customer']['id']); ?>
                        &nbsp;
                     </td>
                </tr>
            <?php endif; ?>

            <tr>
                <th><?php echo __('First Name'); ?></th>
                <td>
                    <?php echo h($customer['Customer']['first_name']); ?>
                    &nbsp;
                </td>
            </tr>

            <tr>
                <th><?php echo __('Last Name'); ?></th>
                <td>
                    <?php echo h($customer['Customer']['last_name']); ?>
                    &nbsp;
                </td>
            </tr>

            <tr>
                <th><?php echo __('Dob'); ?></th>
                <td>
                    <?php echo h($customer['Customer']['dob']); ?>
                    &nbsp;
                </td>
            </tr>

            <tr>
                <th><?php echo __('Gender'); ?></th>
                <td>
                    <?php echo h($customer['Gender']['name']); ?>
                    &nbsp;
                </td>
            </tr>
        </table>

        <table style=" float:left; width:40%;  margin-left: 5%; margin-bottom:3%;" class="table">
            <tr>
             <th style="width:200px; background-color:#FFADCF; color:#fff; font-size:180%;"><?php echo __('Address Detail'); ?></th>
            </tr>

            <tr>
                <th><?php echo __('Street'); ?></th>
                <td>
                    <?php echo h($customer['Customer']['street']); ?>
                    &nbsp;
                </td>
            </tr>

            <tr>
                <th><?php echo __('Suburb'); ?></th>
                <td>
                    <?php echo h($customer['Customer']['suburb']); ?>
                    &nbsp;
                </td>
            </tr>

            <tr>
                <th><?php echo __('City'); ?></th>
                <td>
                    <?php echo h($customer['Customer']['city']); ?>
                    &nbsp;
                </td>
            </tr>

            <tr>
                <th><?php echo __('State'); ?></th>
                <td>
                    <?php echo h($customer['Customer']['state']); ?>
                    &nbsp;
                </td>
            </tr>


            <tr>
                <th><?php echo __('Postcode'); ?></th>
                <td>
                    <?php echo h($customer['Customer']['postcode']); ?>
                    &nbsp;
                </td>
            </tr>


            <tr>
                <th><?php echo __('Country'); ?></th>
                <td>
                    <?php echo h($customer['Customer']['country']); ?>
                    &nbsp;
                </td>
            </tr>
        </table>


        <table style="width:40%;" class="table">

            <tr>
             <th style="width:200px; background-color:#FFADCF; color:#fff; font-size:180%;"><?php echo __('Account Detail'); ?></th>
            </tr>

            <tr>
                <th><?php echo __('Phone'); ?></th>
                <td>
                    <?php echo h($customer['Customer']['phone']); ?>
                    &nbsp;
                </td>
            </tr>

            <tr>
                <th><?php echo __('Join Date'); ?></th>
                <td>
                    <?php echo h($customer['Customer']['join_date']); ?>
                    &nbsp;
                </td>
            </tr>

            <?php if ($current_customer['group_id'] == '1'): ?>
                <tr>
                    <th><?php echo __('Username'); ?></th>
                    <td>
                        <?php echo h($customer['Customer']['username']); ?>
                        &nbsp;
                    </td>
                </tr>
            <?php endif; ?>

            <tr>
                <th><?php echo __('Email'); ?></th>
                <td>
                    <?php echo h($customer['Customer']['email']); ?>
                    &nbsp;
                </td>
            </tr>


            <tr>
                <th><?php echo __('Last Login'); ?></th>
                <td>
                    <?php echo h($customer['Customer']['last_login']); ?>
                    &nbsp;
                </td>
            </tr>

            <?php if ($current_customer['group_id'] == '1'): ?>
                <tr>
                    <th><?php echo __('Group'); ?></th>
                    <td>
                        <?php echo h($customer['Group']['name']); ?>
                        &nbsp;
                    </td>
                </tr>
            <?php endif; ?>

            <tr>

                <!--
                        <dt><?php echo __('Password'); ?></dt>
                <td>
                    <?php echo h($customer['Customer']['password']); ?>
                    &nbsp;
                </td>
                        -->
            </tr>
        </table>


        <div style="border-top:solid 1px; margin-top:10%;" class="related">
            <!--<h4><?php echo __('Related Sales'); ?></h4>


            <?php if (!empty($customer['Sale'])): ?>
                <table cellpadding = "0" cellspacing = "0"  class="table table-striped table-bordered">
                    <tr>
                        <th><?php echo __('Id'); ?></th>
                        <th><?php echo __('Date'); ?></th>
                        <th><?php echo __('Name'); ?></th>

                        <th><?php echo __('sale_price'); ?></th>

                    </tr>

                    <?php
                        $i = 0;
                        foreach ($customer['Sale'] as $sale): ?>
                        <tr>
                            <td><?php echo $sale['id']; ?></td>
                            <td><?php echo $sale['created'];?></td>
                            <td><?php echo $sale['customer_id']; ?></td>
                            <td><?php echo $sale['sale_price']; ?></td>
                        </tr>
                    <?php endforeach; ?>
                </table>
            <?php endif; ?> -->

            <h4><?php echo __('Related Online Sales'); ?></h4>
            <?php if (!empty($customer['Order'])): ?>
                <table cellpadding = "0" cellspacing = "0"  class="table table-striped table-bordered" style="margin-bottom:0px">
                    <tr>
                        <th width="50px"><?php echo __('Order ID'); ?></th>
                        <th width="80px"><?php echo __('Date'); ?></th>
                        <th width="100px"><?php echo __('Tracking Number'); ?></th>
                        <th width="50px"><?php echo __('Delivery Status'); ?></th>
                        <th width="50px"><?php echo __('Total'); ?></th>
                    </tr>
							
                    <?php 
					for($i=0;$i<count($Customerorders);$i++) {  ?> 
					<tr>
					<td><?php echo $Customerorders[$i]['id']; ?></td>
					<td><?php echo $Customerorders[$i]['created']; ?></td>
					<td><?php echo $Customerorders[$i]['tracking']; ?></td>
					<td><?php echo $Customerorders[$i]['name']; ?></td>
					<td><?php echo $Customerorders[$i]['total']; ?></td>
					</tr>
                    <?php } ?>
					</table>
            <?php endif; ?>


            <?php if ($current_customer['group_id'] == 1): ?>
                <div style="margin-left:80%; " class="actions">
                    <ul>
                        <li style="list-style-type:none; margin-left:0; padding-top:15px;"><?php echo $this->Html->link(__('Add item to this brand'), array('controller' => 'sales', 'action' => 'add')); ?> </li>
                    </ul>
                </div>
            <?php endif; ?>
            <!--<?php debug($customer); ?>-->
        </div>
    </div>

